package com.zhuang.observer.observable_example;

import java.util.Observable;

/**
 * @Classname Thief
 * @Description 小偷类 继承Observable接口
 * @Date 2021/3/28 14:36
 * @Created by dell
 */

public class Thief extends Observable {
    private String name;

    public Thief(String name) {
        this.name = name;
    }

    public Thief() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void steal() {
        System.out.println("小偷：我偷东西，有没有人来抓我！！！");
        super.setChanged();//默认为true
        super.notifyObservers();
    }
}
